import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HotelsVO, HotelsForm, HotelsQuery } from '@/api/hotel/hotels/types';

/**
 * 查询酒店信息维护列表
 * @param query
 * @returns {*}
 */

export const listHotels = (query?: HotelsQuery): AxiosPromise<HotelsVO[]> => {
  return request({
    url: '/hotel/hotels/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询酒店信息维护详细
 * @param id
 */
export const getHotels = (id: string | number): AxiosPromise<HotelsVO> => {
  return request({
    url: '/hotel/hotels/' + id,
    method: 'get'
  });
};

/**
 * 新增酒店信息维护
 * @param data
 */
export const addHotels = (data: HotelsForm) => {
  return request({
    url: '/hotel/hotels',
    method: 'post',
    data: data
  });
};

/**
 * 修改酒店信息维护
 * @param data
 */
export const updateHotels = (data: HotelsForm) => {
  return request({
    url: '/hotel/hotels',
    method: 'put',
    data: data
  });
};

/**
 * 删除酒店信息维护
 * @param id
 */
export const delHotels = (id: string | number | Array<string | number>) => {
  return request({
    url: '/hotel/hotels/' + id,
    method: 'delete'
  });
};
/*酒店下拉*/
export const selectComb = (query?: HotelsQuery): AxiosPromise<HotelsVO[]> => {
  return request({
    url: '/hotel/hotels/selectComb',
    method: 'get',
    params: query
  });
};